package com.study.dubbo.reference.config;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ConsumerConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lin
 * @create 2018-07-30 17:05
 **/
@Configuration
public class DubboConfiguration {

    @Bean
    public ApplicationConfig applicationConfig() {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName("consumer-test");
        return applicationConfig;
    }

    @Bean
    public ConsumerConfig consumerConfig() {
        ConsumerConfig consumerConfig = new ConsumerConfig();
        consumerConfig.setClient("netty4");
        consumerConfig.setTimeout(3000);
        consumerConfig.setFilter("tracing");
//        consumerConfig.setFilter("com.study.dubbo.service.zipkin.TracingFilter");
//        consumerConfig.setFilter("123");
        return consumerConfig;
    }
//    @Bean
//    public TracingFilter tracingFilter(){
//        return new TracingFilter();
//    }


    @Bean
    public RegistryConfig registryConfig() {
        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress("zookeeper://192.168.120.128:2181");
        registryConfig.setClient("curator");
        return registryConfig;
    }
}